package cn.wyl.controller;

import cn.wyl.Product;
import cn.wyl.result.JsonResult;
import cn.wyl.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


//用户服务：暴露接口给订单访问
@RestController
public class ProductController {

    @Autowired
    private IProductService productService;


    @PostMapping("/product/add")
    public JsonResult add(@RequestBody Product product){
        try {
            productService.add(product);
            return new JsonResult(true,"product及store添加成功");
        } catch (Exception e) {
            e.printStackTrace();
            return new JsonResult(false,"product及store添加失败,"+e.getMessage());
        }

    }




}
